import bodyParser from 'koa-bodyparser'
import logger from 'koa-logger'
import session from 'koa-session'
import serve from 'koa-static'
const { resolve } = require('path')
const r = path => resolve(__dirname, path)
export const addVies=app=>{
    app.use(serve(r('../../static')))
}

export const addBodyParser=app=>{
    app.use(bodyParser())
}

export const addLogger=app=>{
    app.use(logger())
}
export const addSession=app=>{
    app.keys=['movie']

    const CONFIG={
        key:'koa:sess',
        maxAge:86400000,
        overwrite:true,
        httpOnly:false,
        signed:true,
        rolling:false
    }
    app.use(session(CONFIG,app))
}